// 菜单 不同用户的菜单-管理员-学生-教师
const router = require('express').Router()
// const db = require('../db')

router.get('/nav', (req, res) => {
    res.json({
        code: 0,
        menuList: menuList[req.query.user.role]
    })
})
module.exports = router
const menuList = {}

menuList.admin = [
    {
        parentId: -1,
        id: 2,
        name: "试卷管理",
        icon: "el-icon-s-promotion",
        path: "paper",
        url: null,
        children: [
            {
                parentId: 1,
                id: 2,
                name: "试卷列表",
                icon: "el-icon-s-promotion",
                url: null,
                path: "paper/index",
                children: null
            },
            {
                parentId: 1,
                id: 3,
                name: "新增试卷",
                icon: "el-icon-folder-checked",
                url: null,
                path: "paper/add",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 100,
        name: "学生管理",
        icon: "el-icon-s-custom",
        path: "student/index",
        url: null,
        children: [
            {
                parentId: 100,
                id: 102,
                name: "学生列表",
                icon: "",
                url: null,
                path: "student/index",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 200,
        name: "教师管理",
        icon: "",
        path: "teacher/index",
        url: null,
        children: [
            {
                parentId: 200,
                id: 202,
                name: "教师列表",
                icon: "",
                url: null,
                path: "teacher/index",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 300,
        name: "题库管理",
        icon: "",
        path: "question",
        url: null,
        children: [
            {
                parentId: 300,
                id: 301,
                name: "试题列表",
                icon: "",
                url: null,
                path: "question/index",
                children: null
            },
            {
                parentId: 300,
                id: 302,
                name: "新增试题",
                icon: "",
                url: null,
                path: "question/add",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 400,
        name: "课程管理",
        icon: "el-icon-thumb",
        path: "exam",
        url: null,
        children: [
            {
                parentId: 400,
                id: 401,
                name: "添加课程",
                icon: "",
                url: null,
                // path: "/index",
                children: null
            },
            {
                parentId: 400,
                id: 404,
                name: "课程列表",
                icon: "",
                url: null,
                path: "course/index",
                children: null
            }
        ]
    }
]

menuList.teacher = [
    {
        parentId: -1,
        id: 2,
        name: "试卷管理",
        // icon: "icon-shijuan",
        icon: "el-icon-s-promotion",
        path: "paper",
        url: null,
        children: [
            {
                parentId: 1,
                id: 2,
                name: "试卷列表",
                // icon: "icon-shijuan",
                icon: "el-icon-s-promotion",
                url: null,
                path: "paper/index",
                children: null
            },
            {
                parentId: 1,
                id: 3,
                name: "新增试卷",
                // icon: "icon-xinzeng",
                icon: "el-icon-folder-checked",
                url: null,
                path: "paper/add",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 100,
        name: "学生管理",
        // icon: "icon-student",
        icon: "el-icon-s-custom",
        path: "student/index",
        url: null,
        children: [
            {
                parentId: 100,
                id: 102,
                name: "学生列表",
                icon: "",
                url: null,
                path: "student/index",
                children: null
            }
        ]
    },
    {
        parentId: -1,
        id: 300,
        name: "题库管理",
        // icon: "icon-tiku",
        icon: "el-icon-s-custom",
        path: "question",
        url: null,
        children: [
            {
                parentId: 300,
                id: 301,
                name: "试题列表",
                // icon: "icon-tiku",
                icon: "el-icon-s-custom",
                url: null,
                path: "question/index",
                children: null
            },
            {
                parentId: 300,
                id: 302,
                name: "新增试题",
                // icon: "icon-xinzeng",
                icon: "el-icon-s-custom",
                url: null,
                path: "question/add",
                children: null
            }
        ]
    },
    // {
    //     parentId: -1,
    //     id: 400,
    //     name: "考试管理",
    //     icon: "el-icon-thumb",
    //     path: "exam",
    //     url: null,
    //     children: [
    //         {
    //             parentId: 400,
    //             id: 401,
    //             name: "考卷列表",
    //             icon: "",
    //             url: null,
    //             path: "exam/index",
    //             children: null
    //         },
    //         {
    //             parentId: 400,
    //             id: 404,
    //             name: "考试记录",
    //             icon: "",
    //             url: null,
    //             path: "exam/record",
    //             children: null
    //         }
    //     ]
    // }
]


menuList.student = [
    {
        parentId: -1,
        id: 400,
        name: "考试中心",
        icon: "el-icon-thumb",
        path: "exam",
        url: null,
        children: [
            {
                parentId: 400,
                id: 401,
                name: "考卷列表",
                icon: "",
                url: null,
                path: "exam/index",
                children: null
            },
            {
                parentId: 400,
                id: 404,
                name: "考试记录",
                icon: "",
                url: null,
                path: "exam/record",
                children: null
            }
        ]
    },
]